//import CommonCrypto
@testable import MonkeyKing
import XCTest

final class MonkeyKingTests: XCTestCase {
    func testExample() {
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct
        // results.

//        let string = "abcde"
//        print(string.sha1())
//        print(string.sha1_())
    }

    static var allTests = [
        ("testExample", testExample),
    ]
}

//extension String {
//    func sha1() -> String {
//        let data = Data(utf8)
//        var digest = [UInt8](repeating: 0, count: Int(CC_SHA1_DIGEST_LENGTH))
//        data.withUnsafeBytes {
//            _ = CC_SHA1($0.baseAddress, CC_LONG(data.count), &digest)
//        }
//        let hexBytes = digest.map { String(format: "%02hhx", $0) }
//        return hexBytes.joined()
//    }
//
//    func sha1_() -> String {
//        let data = Data(utf8)
//        let digest = SHA1(message: data).calculate().rawBytes
//        let hexBytes = digest.map { String(format: "%02hhx", $0) }
//        return hexBytes.joined()
//    }
//}
